package com.haha.helloworld;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.haha.helloworld.anime.ObjectAnimeActivity;
import com.haha.helloworld.broadcast.BroadActivity;
import com.haha.helloworld.datastorage.DataStorageActivity;
import com.haha.helloworld.event.EventActivity;
import com.haha.helloworld.fragment.ContainerActivity;
import com.haha.helloworld.gridview.GridViewActivity;
import com.haha.helloworld.jump.AActivity;
import com.haha.helloworld.listview.ListViewActivity;
import com.haha.helloworld.recyclerview.RecyclerViewActivity;

public class MainActivity extends AppCompatActivity {
    //定义一个Button类，取名为hahaButton
    private Button ToTestView_Button;
    private Button ToButton_Button;
    private Button ToEditView_Button;
    private Button ToRadioButton_Button;
    private Button ToCheckBoxButton_Button;
    private Button ToImageView_Button;
    private Button ToListView_Button;
    private Button ToGridView_Button;
    private Button ToRecyclerView_Button;
    private Button ToWebView_Button;
    private Button ToToastView_Button;
    private Button ToDialog_Button;
    private Button ToProgress_Button;
    private Button ToCustomDialog_Button;
    private Button ToPopupWindow_Button;
    private Button ToLifeCycle_Button;
    private Button ToA_Button;
    private Button ToContainer_Button;
    private Button ToEvent_Button;
    private Button ToHandler_Button;
    private Button ToData_Button;
    private Button ToBroad_Button;
    private Button ToAnime_Button;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //通过findViewById方法通过id找到我们的button，返回的是一个View类型
        View viewById = findViewById(R.id.ToTestView_Button);
        //权限设置
        ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},1);

        //将View类型转换为Button，再赋值给hahaButton
        ToTestView_Button=(Button) viewById;
        //给这个button设置一个点击事件
        ToTestView_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this,TestViewActivity.class);
                startActivity(intent);
            }
        });

        //跳转到buttonView的button
        ToButton_Button= (Button)findViewById(R.id.ToButton_Button);
        ToButton_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this,ButtonActivity.class);
                startActivity(intent);
            }
        });

        //跳转到editview的button
        ToEditView_Button= (Button)findViewById(R.id.ToEditView_Button);
        ToEditView_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this,EditViewActivity.class);
                startActivity(intent);
            }
        });

        //跳转到RadioButton的button
        ToRadioButton_Button= (Button)findViewById(R.id.ToRadioButton_Button);
        ToRadioButton_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this,RadioButtonActivity.class);
                startActivity(intent);
            }
        });

        //跳转到CheckBox的button
        ToCheckBoxButton_Button= (Button)findViewById(R.id.ToCheckBoxButton_Button);
        ToCheckBoxButton_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this,CheckBoxActivity.class);
                startActivity(intent);
            }
        });

        //跳转到CheckBox的button
        ToImageView_Button= (Button)findViewById(R.id.ToImageView_Button);
        ToImageView_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this,ImageViewActivity.class);
                startActivity(intent);
            }
        });
        //跳转到ListView的button
        ToListView_Button= (Button)findViewById(R.id.ToListView_Button);
        ToListView_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, ListViewActivity.class);
                startActivity(intent);
            }
        });

        //跳转到GridView的button
        ToGridView_Button= (Button)findViewById(R.id.ToGridView_Button);
        ToGridView_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, GridViewActivity.class);
                startActivity(intent);
            }
        });

        //跳转到LinearRecyclerView的button
        ToRecyclerView_Button= (Button)findViewById(R.id.ToRecyclerView_Button);
        ToRecyclerView_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, RecyclerViewActivity.class);
                startActivity(intent);
            }
        });

        //跳转到WebView的button
        ToWebView_Button= (Button)findViewById(R.id.ToWebView_Button);
        ToWebView_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, WebViewActivity.class);
                startActivity(intent);
            }
        });

        //跳转到ToastView的button
        ToToastView_Button= (Button)findViewById(R.id.ToToastView_Button);
        ToToastView_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, ToastActivity.class);
                startActivity(intent);
            }
        });

        //跳转到Dialog的button
        ToDialog_Button= (Button)findViewById(R.id.ToDialog_Button);
        ToDialog_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, DialogActivity.class);
                startActivity(intent);
            }
        });
        //跳转到Progress的button
        ToProgress_Button= (Button)findViewById(R.id.ToProgress_Button);
        ToProgress_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, ProgressActivity.class);
                startActivity(intent);
            }
        });

        //跳转到CustomDialog的button
        ToCustomDialog_Button= (Button)findViewById(R.id.ToCustomDialog_Button);
        ToCustomDialog_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, CustomDialogActivity.class);
                startActivity(intent);
            }
        });

        //跳转到PopupWindow的button
        ToPopupWindow_Button= (Button)findViewById(R.id.ToPopupWindow_Button);
        ToPopupWindow_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, PopupWindowActivity.class);
                startActivity(intent);
            }
        });
        //跳转到LifeCycle的button
        ToLifeCycle_Button= (Button)findViewById(R.id.ToLifeCycle_Button);
        ToLifeCycle_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, LifeCycleActivity.class);
                startActivity(intent);
            }
        });
        //跳转到A的button
        ToA_Button= (Button)findViewById(R.id.ToA_Button);
        ToA_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, AActivity.class);
                startActivity(intent);
            }
        });
        //跳转到A的button
        ToContainer_Button= (Button)findViewById(R.id.ToContainer_Button);
        ToContainer_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, ContainerActivity.class);
                startActivity(intent);
            }
        });

        //跳转到Event的button
        ToEvent_Button= (Button)findViewById(R.id.ToEvent_Button);
        ToEvent_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, EventActivity.class);
                startActivity(intent);
            }
        });

        //跳转到Handler的button
        ToHandler_Button= (Button)findViewById(R.id.ToHandler_Button);
        ToHandler_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, HandlerActivity.class);
                startActivity(intent);
            }
        });

        //跳转到Data的button
        ToData_Button= (Button)findViewById(R.id.ToData_Button);
        ToData_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, DataStorageActivity.class);
                startActivity(intent);
            }
        });

        //跳转到Broad的button
        ToBroad_Button= (Button)findViewById(R.id.ToBroad_Button);
        ToBroad_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, BroadActivity.class);
                startActivity(intent);
            }
        });
        //跳转到Anime的button
        ToAnime_Button= (Button)findViewById(R.id.ToAnime_Button);
        ToAnime_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到其他页面
                Intent intent = new Intent(MainActivity.this, ObjectAnimeActivity.class);
                startActivity(intent);
            }
        });

    }
}